<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Joomla Security
defined('_JEXEC') or die;

jimport('joomla.application.component.view');
jimport( 'joomla.document.json.json' );
 
/**
 * HTML View class for the HelloWorld Component
 */
class JoosamViewdata extends Jview
{
	// Overwriting JView display method
	function display($tpl = null){

		## Build songdata object
		$data = new jsamSongdata();
		$mod = new jsamModules();
		
		$search = $data->getInfo('ajax', '');
		$live = $mod->getInfo('jsonLive');
		$songid = $mod->getInfo('songid');
		$history = $mod->getInfo('jsonHistory');

		if (count($errors = $this->get('Errors'))){
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}

		// Assign data to the view
		$this->search = $search;
		$this->live = $live;
		$this->songid = $songid;
		$this->history = $history;
		$this->setDocument();

 
		// Display the view
		parent::display($tpl);
	}

	protected function setDocument() 
	{
		$document = JFactory::getDocument();
		$document->setMimeEncoding( 'application/json' );
	}
}